package com.example.black.myapplication.myrevealview;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageView;

import com.example.black.myapplication.R;

public class RevealViewActivity extends AppCompatActivity {

    private ImageView ivBack;
    private int originalLevel = 5000;
    private int[] mImgIds = new int[] { //7个
            R.drawable.avft,
            R.drawable.box_stack,
            R.drawable.bubble_frame,
            R.drawable.bubbles,
            R.drawable.bullseye,
            R.drawable.circle_filled,
            R.drawable.circle_outline,

            R.drawable.avft,
            R.drawable.box_stack,
            R.drawable.bubble_frame,
            R.drawable.bubbles,
            R.drawable.bullseye,
            R.drawable.circle_filled,
            R.drawable.circle_outline
    };
    private int[] mImgIds_active = new int[] {
            R.drawable.avft_active, R.drawable.box_stack_active, R.drawable.bubble_frame_active,
            R.drawable.bubbles_active, R.drawable.bullseye_active, R.drawable.circle_filled_active,
            R.drawable.circle_outline_active,
            R.drawable.avft_active, R.drawable.box_stack_active, R.drawable.bubble_frame_active,
            R.drawable.bubbles_active, R.drawable.bullseye_active, R.drawable.circle_filled_active,
            R.drawable.circle_outline_active
    };
    private RevealDrawable[] drawables;
    private GalleryHorizontalScrollView hzv;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_reveal_view);
        initData();
        initView();

    }

    private void initData() {
        drawables = new RevealDrawable[mImgIds.length];
        for (int i = 0; i< mImgIds.length ;i++){
            drawables[i] = new RevealDrawable(getDrawable(mImgIds[i]),getDrawable(mImgIds_active[i]),1);
        }
    }

    private void initView() {

        hzv = (GalleryHorizontalScrollView)findViewById(R.id.hsv);
        hzv.addImageViews(drawables);
//        ivBack = findViewById(R.id.iv_back);
//        RevealDrawable drawable =  new RevealDrawable(
//                getDrawable(R.drawable.avft)
//                ,getDrawable(R.drawable.avft_active)
//                ,RevealDrawable.VERTICAL
//        );
//        ivBack.setImageDrawable(
//            drawable
//        );
//        ivBack.setImageLevel(originalLevel);
//        ivBack.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                originalLevel += 1000;
//                if (originalLevel < 0 || originalLevel >10000){
//                    originalLevel = 5000;
//                }
//                drawable.setLevel(originalLevel);
//            }
//        });
    }

}
